﻿package mortal.game.net.command.pack
{
    import Framework.MQ.*;
    import Message.Game.*;
    import Message.Public.*;
    import com.gengine.debug.*;
    import mortal.game.cache.*;
    import mortal.game.manager.*;
    import mortal.game.net.broadCast.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.view.common.cd.*;
    import mortal.game.view.drugBack.*;

    public class ItemCdCommand extends BroadCastCall
    {

        public function ItemCdCommand(param1:Object)
        {
            super(param1);
            return;
        }// end function

        override public function call(param1:MessageBlock) : void
        {
            var _loc_3:ICDData = null;
            var _loc_5:ItemData = null;
            var _loc_6:String = null;
            Log.debug("I have recieve ItemCdCommand");
            super.call(param1);
            var _loc_2:* = param1.messageBase as SDrugCanUseDtMsg;
            var _loc_4:* = ClockManager.instance.nowDate;
            if (_loc_4.time < _loc_2.canUseInstantLifeDrugDt.time)
            {
                _loc_5 = DrugPackUtil.getCdKeyByType(EDrug._EDrugLifeInstant);
                _loc_6 = CDCache.getKey(_loc_5.itemInfo);
                _loc_3 = Cache.instance.cd.registerCDData(CDDataType.itemData, _loc_6);
                if (_loc_3)
                {
                    _loc_3.beginTime = _loc_2.canUseInstantLifeDrugDt.time - _loc_4.time - _loc_5.itemInfo.cdTime * 1000;
                    _loc_3.totalTime = _loc_5.itemInfo.cdTime * 1000;
                    _loc_3.startCoolDown();
                }
            }
            return;
        }// end function

    }
}
